package com.bai.ad.controller;

import com.alibaba.fastjson.JSON;
import com.bai.ad.service.ICreativeService;
import com.bai.ad.vo.CreativeRequest;
import com.bai.ad.vo.CreativeResponse;
import com.bao.ad.exception.AdException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName CreativeOPController
 *
 * @author Bai
 * @version 1.0
 * @date 2019/2/24 0024 下午 13:54
 **/
@Slf4j
@RestController
public class CreativeOPController {

    private final ICreativeService creativeService;

    @Autowired
    public CreativeOPController(ICreativeService creativeService) {
        this.creativeService = creativeService;
    }

    public CreativeResponse createCreative(
            CreativeRequest request) throws AdException {
        log.info("ad-sponsor: createCreative -> {}", JSON.toJSONString(request));
        return creativeService.createCreative(request);
    }

}
